<%@ Page Language="C#" MasterPageFile="~/Admin/Admin.Master" CodeBehind="Events.aspx.cs" Inherits="Impact.Web.Admin.Events" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">

    <table class="AdminTable">
        <tr>
            <th>Events:</th>
            <th class="NonHeader">Location</th>
            <th class="NonHeader">Enabled</th>
            <th class="NonHeader">Delete</th>
        </tr>

    <asp:Repeater ID="eventList" runat="server" OnItemCommand="EventList_ItemCommand">
        <ItemTemplate>
            <tr>
                <td style="width: 200px; text-align: left; padding-left: 30px;">
                    <a href="EditEvent.aspx?id=<%# Eval("EventId") %>"><%# Eval("Name") %></a>
                </td>
                
                <td style="text-align: center;">
                    <%# Eval("Location") %>
                </td>
                               
                <td style="text-align: center;">
                    <asp:ImageButton ID="enabledButton" CommandName="toggle" CommandArgument='<%# Eval("EventId") %>' 
                        ImageUrl='<%# Convert.ToBoolean(Eval("Enabled")) ? "images/checked.png" : "images/unchecked.png" %>' runat="server" />
                </td>
                                        
                <td style="text-align: center;">
                    <asp:ImageButton ID="deleteButton" CommandName="delete" CommandArgument='<%# Eval("EventId") %>'
                        ImageUrl="images/red-x.png" runat="server" />
                </td>
            </tr>
                               
        </ItemTemplate>
    </asp:Repeater>
    
    <asp:Panel ID="noEventsPanel" Visible="false" runat="server">
        <tr>
            <td colspan="7">There have been no events defined yet.</td>
        </tr>
    </asp:Panel>
    
        <tr>
            <td colspan="7" style="text-align: right;">
                <impact:ImageLinkButton ID="newEventButton" CssClass="AdminTableButton" runat="server"
                    ImageUrl="images/add.png" Text="Create New Event" TargetUrl="EditEvent.aspx" />
            </td>
        </tr>
    </table>    

</asp:Content>